import axios from '@/libs/api.request'
export const addRole = (name, access) => { // 添加角色
  const data = {
    name,
    access
  }
  return axios.request({
    url: 'api/role',
    method: 'post',
    data
  })
}
export const QueryRole = (currentPage, pageSize, isPaging, search) => { // 查询所有的角色
  const params = {
    currentPage,
    pageSize, // 每页几条
    isPaging, // 是否开启分页
    search // 模糊查询
  }
  return axios.request({
    url: 'api/role',
    method: 'get',
    params
  })
}
export const deleteRole = (id) => { // 删除指定角色
  const data = {
    id
  }
  return axios.request({
    url: 'api/role',
    method: 'delete',
    data
  })
}
export const updateRole = (id, access, name) => { // 修改指定角色
  const data = {
    access,
    name
  }
  return axios.request({
    url: 'api/role/' + id,
    method: 'put',
    data
  })
}
